﻿@using Telerik.Web.Mvc.UI;
@using IT.CMS.Web.Framework.Web;
@using IT.CMS.Services.Security;
@using IT.CMS.Core.Domain.Security;
@model Dictionary<string, object>

@{

    string NodeActionName = null;
    var action = Model["ActionName"];
    if (action != null && !string.IsNullOrEmpty(action.ToString()))
    {
        NodeActionName = action.ToString();
    }


    string NodeControllerName = null;
    var controller = Model["ControllerName"];
    if (controller != null && !string.IsNullOrEmpty(controller.ToString()))
    {
        NodeControllerName = controller.ToString();
    }

    string NodeResourceNameName = null;
    var resourceName = Model["ResourceName"];
    if (resourceName != null && !string.IsNullOrEmpty(resourceName.ToString()))
    {
        NodeResourceNameName = resourceName.ToString();
    }

    string NodeIconClass = null;
    var iconClass = Model["IconClass"];
    if (iconClass != null && !string.IsNullOrEmpty(iconClass.ToString()))
    {
        NodeIconClass = iconClass.ToString();
    }        
    
    var chaildNodesCount = 0;
    int.TryParse(Model["ChaildNodesCount"].ToString(), out chaildNodesCount);
    
    }

<li class=@((chaildNodesCount > 0) ? "dropdown" : "")>
    <a href="@(NodeActionName != null && NodeControllerName != null ? Url.Action(NodeActionName.ToString(), NodeControllerName.ToString(), new RouteValueDictionary() { { "area", "Admin" } }) : "#")"
        class="@((chaildNodesCount > 0) ? "dropdown-toggle" : "")" data-toggle="@((chaildNodesCount > 0) ? "dropdown" : "")">
    <i class="@((NodeIconClass != null) ? NodeIconClass.ToString() : "none")"></i>    
    <span>@((NodeResourceNameName != null) ? T(NodeResourceNameName.ToString()).ToHtmlString() : "no")</span>
        </a>
